home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / createBlendShapePanelMenu.me < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.3 KB  |  166 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:     13aug 1997
  22. //  Author:         ks
  23. //
  24. //
  25.  
  26. global proc blendShapeMenuCmd( string $editorName, string $itemName )
  27. //
  28. //  Procedure Name:
  29. //      blendShapeMenuCmd
  30. //
  31. //  Description:
  32. //        Command attached to menu items in the blend shape editor
  33. //
  34. //  Input Arguments:
  35. //        string $editorName - name of the editor
  36. //        string $itemName - name of the menu item calling the proc
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41. {
  42.     string $itemCmd;
  43.     string $msg;
  44.     int $error = false;
  45.  
  46.     int $querVal = `blendShapeEditor -q -vs $editorName`;
  47.     int $setVal = $querVal;
  48.     if($itemName == "bseMIHoriz") {
  49.         $setVal = 0;
  50.     } else if ($itemName == "bseMIVertical") {
  51.         $setVal = 1;
  52.     }
  53.  
  54.     if ($setVal != $querVal) {
  55.         $itemCmd = "blendShapeEditor -e -vs " + $setVal + " " + $editorName;
  56.         evalEcho $itemCmd;
  57.     }
  58. }
  59.  
  60. global proc buildBlendShapeContextHelpItems(string $nameRoot, string $menuParent)
  61. //
  62. //  Description:
  63. //        Build context sensitive menu items
  64. //        
  65. //  Input Arguments:
  66. //        $nameRoot - name to use as the root of all item names
  67. //        $menuParent - the name of the parent of this menu
  68. //
  69. //  Return Value:
  70. //      None
  71. //
  72. {
  73.     menuItem -label "Help on Editing Blend Shapes..."
  74.         -enableCommandRepeat false
  75.         -command "showHelp EditBlendShape";
  76. }
  77.  
  78.  
  79. global proc createBlendShapePanelMenu( string $panel )
  80. //
  81. //  Procedure Name:
  82. //      createBlendShapePanelMenu
  83. //
  84. //  Description:
  85. //         Create a new blendShape panel with the menu bar
  86. //
  87. //  Input Arguments:
  88. //      string $panel - the name of the panel
  89. //
  90. //  Return Value:
  91. //      None.
  92. //
  93. {
  94.     // if this menu has already been built, return
  95.     //
  96.     {
  97.         string $panelControl = `panel -q -control $panel`;
  98.         if ( `menuBarLayout -exists $panelControl` ){
  99.             string $ma[] = `menuBarLayout -q -menuArray $panelControl`;
  100.             for ( $name in $ma ){
  101.                 if ( $name == "Panels" ) {
  102.                     return;
  103.                 }
  104.                 if ( $name == ($panel+"EditMenu")) {
  105.                     return;
  106.                 }
  107.             }
  108.             setParent $panelControl;
  109.         }
  110.     }
  111.  
  112.     //    Add support for the Context Sensitive Help Menu.
  113.     //
  114.     addContextHelpProc $panel "buildBlendShapeContextHelpItems";
  115.         
  116.     // By the time we get here, we know the menu bar
  117.     // of the blendShapePanel is the current menu bar
  118.     //
  119.     // Get the name of the blendShape editor in this panel
  120.     //
  121.      string $ed = `blendShapePanel -q -blendShapeEditor $panel`;
  122.      string $itemName = `menu -tearOff true -l "Edit" ($panel+"EditMenu")`;
  123.     string $itemCmd = ("blendShapeMenuCmd " + $ed);
  124.         menuItem -l "Create BlendShape" 
  125.             -ann "Make a new blendShape target set for the selected base shape"
  126.             -c "blendShape -par"
  127.             bseMINew;
  128.  
  129.         menuItem -l "Deselect All" 
  130.             -ann "Deselect All"
  131.             -c "select -clear"
  132.             bseMIDeselect;
  133.     
  134.      $itemName = `menu -tearOff true -l "Options" ($panel+"OptionsMenu")`;
  135.  
  136.         menuItem -l "Orientation" -subMenu true
  137.             -ann "Toggle the sliders between vertical and horizontal configuration";
  138.  
  139.             radioMenuItemCollection ($panel + "_BlendShapeSliderTypes_");
  140.             
  141.             menuItem -rb 1 -l "Vertical"
  142.                 -c ($itemCmd + " bseMIVertical")
  143.             bseMIVertical;
  144.  
  145.             menuItem -rb 1 -l "Horizontal"
  146.                 -c ($itemCmd + " bseMIHoriz")
  147.             bseMIHoriz;
  148.  
  149.             int $querVal = `blendShapeEditor -q -vs $ed`;
  150.             if($querVal) {
  151.                 menuItem -e -rb 1 bseMIVertical;
  152.             } else {
  153.                 menuItem -e -rb 1 bseMIHoriz;
  154.             }
  155.         setParent -menu ..;
  156.  
  157.     buildPanelPopupMenu( $panel );
  158.  
  159. }
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.